home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / quake.zip / HIPGRAPL.ZIP / HIPSCRGE.QC < prev    next >
Text File  |  1997-01-28  |  16KB  |  526 lines

  1. /*
  2. ==============================================================================
  3.  
  4. SCOURGE
  5.  
  6. ==============================================================================
  7. */
  8.  
  9. $cd hipwork\models\scourge
  10. $origin 0 0 23
  11. $base scorbase.asc
  12.  
  13. $skin skin
  14.  
  15. $frame stand1.asc stand2.asc stand3.asc stand4.asc stand5.asc stand6.asc
  16. $frame stand7.asc stand8.asc stand9.asc stand10.asc stand11.asc stand12.asc
  17.  
  18. $frame walk1.asc walk2.asc walk3.asc walk4.asc walk5.asc walk6.asc
  19.  
  20. $frame shoot1.asc shoot2.asc
  21.  
  22. $frame sting1.asc sting2.asc sting3.asc sting4.asc sting5.asc sting6.asc
  23. $frame sting7.asc sting8.asc sting9.asc sting10.asc sting11.asc
  24.  
  25. $frame pain1.asc pain2.asc pain3.asc pain4.asc pain5.asc
  26.  
  27. $frame death1.asc death2.asc death3.asc death4.asc death5.asc
  28. //
  29.  
  30. $frame stand1.asc stand2.asc stand3.asc stand4.asc stand5.asc stand6.asc stand7.asc
  31.  
  32. $frame sting1.asc sting2.asc sting3.asc sting4.asc sting5.asc sting6.asc sting7.asc sting8.asc
  33. $frame sting9.asc sting10.asc sting11.asc
  34.  
  35. $frame walk1.asc walk2.asc walk3.asc walk4.asc walk5.asc walk6.asc
  36.  
  37. $frame shoot1.asc shoot2.asc
  38.  
  39. $frame pain1.asc pain2.asc pain3.asc pain4.asc pain5.asc
  40.  
  41. $frame death1.asc death2.asc death3.asc death4.asc death5.asc death6.asc death7.asc
  42. /*
  43. ===========
  44. ScourgeCheckAttack
  45.  
  46. The player is in view, so decide to move or launch an attack
  47. Returns FALSE if movement should continue
  48. ============
  49. */
  50. float() ScourgeCheckAttack =
  51. {
  52.     local vector    spot1, spot2;
  53.     local entity    targ;
  54.     local float        chance;
  55.     local float        enemy_yaw;
  56.  
  57.    targ = self.enemy;
  58. // see if any entities are in the way of the shot
  59.    spot1 = self.origin + self.view_ofs;
  60.     spot2 = targ.origin + targ.view_ofs;
  61.  
  62.    if (vlen(spot1 - spot2) <= 100 )
  63.       {
  64.          if (CanDamage (self.enemy, self))
  65.          {
  66.             self.attack_state = AS_MELEE;
  67.             return TRUE;
  68.          }
  69.       }
  70.    if (time < self.attack_finished)
  71.         return FALSE;
  72.  
  73.    if (!enemy_vis)
  74.         return FALSE;
  75.  
  76.  
  77.    chance = spot2_z - spot1_z;
  78.    if (chance > 64)
  79.       return FALSE;
  80.    else if (chance < -200)
  81.       return FALSE;
  82.  
  83.    if (vlen(spot1 - spot2) > 1000)
  84.         return FALSE;
  85.  
  86.    if (vlen(spot1 - spot2) < 150)
  87.         return FALSE;
  88.  
  89.     traceline (spot1, spot2, FALSE, self);
  90.  
  91.    if (trace_inopen && trace_inwater)
  92.         return FALSE;            // sight line crossed contents
  93.  
  94.    if (trace_ent != targ)
  95.       {
  96.         return FALSE;    // don't have a clear shot
  97.       }
  98.  
  99. // missile attack
  100. //   if (enemy_range == RANGE_FAR)
  101. //      return FALSE;
  102.  
  103.    self.attack_state = AS_MISSILE;
  104.     SUB_AttackFinished (2 + 2*random());
  105.     return TRUE;
  106. };
  107.  
  108. void(float ox) SCOURGE_FireSpikes =
  109. {
  110.    local vector   src, vec;
  111.  
  112.    ai_face();
  113.    makevectors(self.angles);
  114.    src = self.origin - '0 0 19' + v_right*ox + v_forward*14;
  115.    vec = (self.enemy.origin + (200*v_forward)) - src;
  116.    vec = normalize(vec);
  117.    sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
  118.    launch_spike (src, vec);
  119.  
  120.    self.attack_finished = time + 0.2;
  121. };
  122.  
  123. // Attack_With_Tail
  124. //
  125. void() Attack_With_Tail =
  126.    {
  127.    local float ldmg;
  128.    local vector   delta;
  129.  
  130.    ai_face ();
  131.  
  132.    delta = self.enemy.origin - self.origin;
  133.  
  134.    if (vlen(delta) > 100)
  135.         return;
  136.     if (!CanDamage (self.enemy, self))
  137.         return;
  138.  
  139.     ldmg = (random() + random() + random()) * 40;
  140.     T_Damage (self.enemy, self, self, ldmg);
  141.    sound (self, CHAN_WEAPON, "shambler/smack.wav", 1, ATTN_NORM);
  142.  
  143.    SpawnMeatSpray (self.origin + v_forward*16, crandom() * 50 * v_right);
  144.    };
  145.  
  146. void() ScourgeTriggerThink;
  147. void() ScourgeTriggerTouch;
  148. void() scourge_think =
  149.    {
  150.    local entity trig;
  151.    if (!self.state)
  152.       {
  153.       trig = spawn();
  154.       trig.angles = '0 0 0';
  155.       trig.solid = SOLID_TRIGGER;
  156.       setsize( trig, '-64 -64 -24', '64 64 64');
  157.       trig.takedamage = DAMAGE_NO;
  158.       trig.movetype = MOVETYPE_NONE;
  159.       trig.modelindex = 0;
  160.       trig.model = "";
  161.       trig.lastvictim = self;
  162.       trig.think = ScourgeTriggerThink;
  163.       trig.touch = ScourgeTriggerTouch;
  164.       trig.nextthink = time + 0.1 + random();
  165.       setorigin(trig,self.origin);
  166.       self.lastvictim = trig;
  167.       self.state = 1;
  168.       }
  169.    if ((self.spawnsilent == 0) && (self.spawnmulti == 1))
  170.       {
  171.       sound (self, CHAN_BODY, "misc/null.wav", 1, ATTN_IDLE);
  172.       }
  173.    else if ((self.spawnsilent == 1) && (self.spawnmulti == 0))
  174.       {
  175.       sound (self, CHAN_BODY, "scourge/walk.wav", 1, ATTN_IDLE);
  176.       }
  177.    self.spawnmulti = self.spawnsilent;
  178.    };
  179.  
  180. void(float dist) ai_right =
  181. {
  182.    walkmove ( (self.angles_y+90), dist);
  183. };
  184.  
  185. void(float dist) ai_left =
  186. {
  187.    walkmove ( (self.angles_y+270), dist);
  188. };
  189. //============================================================================
  190.  
  191. //void() scourge_wake1;
  192. void()   scourge_stand1  =[ $stand1.asc, scourge_stand2  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  193. void()   scourge_stand2  =[ $stand2.asc, scourge_stand3  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  194. void()   scourge_stand3  =[ $stand3.asc, scourge_stand4  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  195. void()   scourge_stand4  =[ $stand4.asc, scourge_stand5  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  196. void()   scourge_stand5  =[ $stand5.asc, scourge_stand6  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  197. void()   scourge_stand6  =[ $stand6.asc, scourge_stand7  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  198. void()   scourge_stand7  =[ $stand7.asc, scourge_stand8  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  199. void()   scourge_stand8  =[ $stand8.asc, scourge_stand9  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  200. void()   scourge_stand9  =[ $stand9.asc, scourge_stand10  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  201. void()   scourge_stand10  =[ $stand10.asc, scourge_stand11  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  202. void()   scourge_stand11  =[ $stand11.asc, scourge_stand12  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  203. void()   scourge_stand12  =[ $stand12.asc, scourge_stand1  ] {self.spawnsilent = 0;ai_stand();scourge_think();};
  204.  
  205. void()   scourge_walk1   =[ $walk1.asc , scourge_walk2   ] {
  206. if (random() < 0.1)
  207.    sound (self, CHAN_VOICE, "scourge/idle.wav", 1, ATTN_IDLE);
  208. self.spawnsilent = 1;
  209. scourge_think();
  210. ai_walk(8);};
  211. void()   scourge_walk2   =[ $walk2.asc , scourge_walk3   ] {ai_walk(8);};
  212. void()   scourge_walk3   =[ $walk3.asc , scourge_walk4   ] {ai_walk(8);};
  213. void()   scourge_walk4   =[ $walk4.asc , scourge_walk5   ] {ai_walk(8);};
  214. void()   scourge_walk5   =[ $walk5.asc , scourge_walk6   ] {ai_walk(8);};
  215. void()   scourge_walk6   =[ $walk6.asc , scourge_walk1   ] {ai_walk(8);};
  216.  
  217. void()   scourge_run1 =[ $walk1.asc  , scourge_run2 ] {
  218. if (random() < 0.1)
  219.    sound (self, CHAN_VOICE, "scourge/idle.wav", 1, ATTN_IDLE);
  220. self.spawnsilent = 1;
  221. scourge_think();
  222. ai_run(18);};
  223. void()   scourge_run2 =[ $walk2.asc  , scourge_run3 ] {scourge_think();ai_run(14);};
  224. void()   scourge_run3 =[ $walk3.asc  , scourge_run4 ] {ai_run(14);};
  225. void()   scourge_run4 =[ $walk4.asc  , scourge_run5 ] {ai_run(14);};
  226. void()   scourge_run5 =[ $walk5.asc  , scourge_run6 ] {ai_run(14);};
  227. void()   scourge_run6 =[ $walk6.asc  , scourge_run1 ] {ai_run(14);};
  228.  
  229. void()   scourge_strafeleft1   =[ $walk1.asc , scourge_strafeleft2   ] {self.spawnsilent = 1;scourge_think();ai_left(20);};
  230. void()   scourge_strafeleft2   =[ $walk2.asc , scourge_strafeleft3   ] {ai_left(20);};
  231. void()   scourge_strafeleft3   =[ $walk3.asc , scourge_strafeleft4   ] {ai_left(20);};
  232. void()   scourge_strafeleft4   =[ $walk4.asc , scourge_strafeleft5   ] {ai_left(14);};
  233. void()   scourge_strafeleft5   =[ $walk5.asc , scourge_strafeleft6   ] {ai_left(14);};
  234. void()   scourge_strafeleft6   =[ $walk6.asc , scourge_run1   ] {ai_left(14);};
  235.  
  236. void()   scourge_straferight1   =[ $walk1.asc , scourge_straferight2   ] {self.spawnsilent = 1;scourge_think();ai_right(20);};
  237. void()   scourge_straferight2   =[ $walk2.asc , scourge_straferight3   ] {ai_right(20);};
  238. void()   scourge_straferight3   =[ $walk3.asc , scourge_straferight4   ] {ai_right(20);};
  239. void()   scourge_straferight4   =[ $walk4.asc , scourge_straferight5   ] {ai_right(14);};
  240. void()   scourge_straferight5   =[ $walk5.asc , scourge_straferight6   ] {ai_right(14);};
  241. void()   scourge_straferight6   =[ $walk6.asc , scourge_run1   ] {ai_right(14);};
  242.  
  243. /*
  244. void()   scourge_wake1  =[ $stand2.asc, scourge_wake2  ] {self.spawnsilent = 0;scourge_think();};
  245. void()   scourge_wake2  =[ $stand3.asc, scourge_wake3  ] {};
  246. void()   scourge_wake3  =[ $stand4.asc, scourge_wake4  ] {};
  247. void()   scourge_wake4  =[ $stand5.asc, scourge_wake5  ] {};
  248. void()   scourge_wake5  =[ $stand6.asc, scourge_wake6  ] {};
  249. void()   scourge_wake6  =[ $stand7.asc, scourge_run1  ]
  250.    {
  251.    SUB_AttackFinished(1);
  252.    };
  253. //void()   scourge_wake7  =[ $stand7.asc, scourge_run1   ] {};
  254. */
  255.  
  256. void()   scourge_turn1  =[ $walk1.asc, scourge_turn2  ] {self.spawnsilent = 1;scourge_think();ai_turn_in_place();};
  257. void()   scourge_turn2  =[ $walk2.asc, scourge_turn3  ] {ai_turn_in_place();};
  258. void()   scourge_turn3  =[ $walk3.asc, scourge_turn4  ] {ai_turn_in_place();};
  259. void()   scourge_turn4  =[ $walk4.asc, scourge_turn5  ] {ai_turn_in_place();};
  260. void()   scourge_turn5  =[ $walk5.asc, scourge_turn6  ] {ai_turn_in_place();};
  261. void()   scourge_turn6  =[ $walk6.asc, scourge_turn1  ] {ai_turn_in_place();};
  262.  
  263. void()   scourge_atk1 =[ $shoot1.asc,   scourge_atk2 ]
  264.    {
  265.    self.spawnsilent = 0;
  266.    scourge_think();
  267.    self.effects = self.effects | EF_MUZZLEFLASH;
  268.    SCOURGE_FireSpikes(40);
  269. //   SCOURGE_FireSpikes(-40);
  270.    };
  271. void()   scourge_atk2 =[ $shoot2.asc,   scourge_atk3 ]
  272.    {
  273.    self.effects = self.effects | EF_MUZZLEFLASH;
  274. //   SCOURGE_FireSpikes(56);
  275.    SCOURGE_FireSpikes(-56);
  276.    };
  277. void()   scourge_atk3 =[ $shoot1.asc,   scourge_atk4 ]
  278.    {
  279.    self.effects = self.effects | EF_MUZZLEFLASH;
  280. //   SCOURGE_FireSpikes(40);
  281.    SCOURGE_FireSpikes(-40);
  282.    };
  283. void()   scourge_atk4 =[ $shoot2.asc,   scourge_atk5 ]
  284.    {
  285.    self.effects = self.effects | EF_MUZZLEFLASH;
  286.    SCOURGE_FireSpikes(56);
  287. //   SCOURGE_FireSpikes(-56);
  288.    };
  289. void()   scourge_atk5 =[ $shoot1.asc,   scourge_atk6 ]
  290.    {
  291.    self.effects = self.effects | EF_MUZZLEFLASH;
  292.    SCOURGE_FireSpikes(40);
  293. //   SCOURGE_FireSpikes(-40);
  294.    };
  295. void()   scourge_atk6 =[ $shoot2.asc,   scourge_atk7 ]
  296.    {
  297.    self.effects = self.effects | EF_MUZZLEFLASH;
  298. //   SCOURGE_FireSpikes(56);
  299.    SCOURGE_FireSpikes(-56);
  300.    };
  301. void()   scourge_atk7 =[ $shoot1.asc,   scourge_atk8 ]
  302.    {
  303.    self.effects = self.effects | EF_MUZZLEFLASH;
  304. //   SCOURGE_FireSpikes(40);
  305.    SCOURGE_FireSpikes(-40);
  306.    };
  307. void()   scourge_atk8 =[ $shoot2.asc,   scourge_run1 ]
  308.    {
  309.    self.effects = self.effects | EF_MUZZLEFLASH;
  310.    SCOURGE_FireSpikes(56);
  311. //   SCOURGE_FireSpikes(-56);
  312.    SUB_AttackFinished (4*random());
  313.    };
  314.  
  315. void()   scourge_melee1 =[ $sting1.asc,   scourge_melee2 ] {self.spawnsilent = 0;scourge_think();ai_charge(3);};
  316. void()   scourge_melee2 =[ $sting2.asc,   scourge_melee3 ] {ai_charge(3);};
  317. void()   scourge_melee3 =[ $sting3.asc,   scourge_melee4 ] {ai_charge(2);};
  318. void()   scourge_melee4 =[ $sting4.asc,   scourge_melee5 ] {ai_charge(2);};
  319. void()   scourge_melee5 =[ $sting5.asc,   scourge_melee6 ]
  320.    {
  321.    sound (self, CHAN_WEAPON, "scourge/tailswng.wav", 1, ATTN_NORM);
  322.    ai_charge(3);
  323.    };
  324. void()   scourge_melee6 =[ $sting6.asc,   scourge_melee7 ] {ai_charge(1);};
  325. void()   scourge_melee7   =[ $sting7.asc,   scourge_melee8   ]
  326.    {
  327.    Attack_With_Tail();
  328.    };
  329. void()   scourge_melee8   =[ $sting8.asc,   scourge_melee9   ] {ai_face();};
  330. void()   scourge_melee9   =[ $sting9.asc,   scourge_melee10   ] {ai_face();};
  331. void()   scourge_melee10   =[ $sting10.asc,   scourge_melee11   ] {ai_face();};
  332. void()   scourge_melee11   =[ $sting11.asc,  scourge_run1 ] {ai_face();
  333. SUB_CheckRefire (scourge_melee1);
  334. };
  335.  
  336. void()   scourge_pain1  =[ $pain1.asc, scourge_pain2  ] {self.spawnsilent = 0;scourge_think();};
  337. void()   scourge_pain2  =[ $pain2.asc, scourge_pain3  ] {};
  338. void()   scourge_pain3  =[ $pain3.asc, scourge_pain4  ] {};
  339. void()   scourge_pain4  =[ $pain4.asc, scourge_pain5  ] {};
  340. void()   scourge_pain5  =[ $pain5.asc, scourge_run1 ] {};
  341.  
  342. void(entity attacker, float damage) scourge_pain =
  343. {
  344.     local float r;
  345.  
  346.  
  347.    if (random()*50 > damage)
  348.         return;        // didn't flinch
  349.  
  350.    if (self.pain_finished > time)
  351.         return;
  352.  
  353.  
  354.    r = random ();
  355.    sound (self, CHAN_VOICE, "scourge/pain.wav", 1, ATTN_NORM);
  356.  
  357.    self.pain_finished = time + 2.0;
  358.    scourge_pain1 ();
  359. };
  360.  
  361. //============================================================================
  362.  
  363.  
  364.  
  365.  
  366. void()   scourge_die1 =[ $death1.asc, scourge_die2 ] {self.spawnsilent = 0;scourge_think();};
  367. void()   scourge_die2 =[ $death2.asc, scourge_die3 ] {};
  368. void()   scourge_die3 =[ $death3.asc, scourge_die4 ] {self.solid = SOLID_NOT;};
  369. void()   scourge_die4 =[ $death4.asc, scourge_die5 ] {};
  370. void()   scourge_die5 =[ $death5.asc, scourge_die5 ] {};
  371.  
  372. void() scourge_die =
  373. {
  374. // check for gib
  375.    // stop sound
  376.    remove (self.lastvictim);
  377.    self.spawnsilent = 0;
  378.    scourge_think();
  379.    if (self.health < -35)
  380.    {
  381.         sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
  382.       ThrowHead ("progs/h_scourg.mdl", self.health);
  383.       ThrowGib ("progs/gib1.mdl", self.health);
  384.         ThrowGib ("progs/gib2.mdl", self.health);
  385.         ThrowGib ("progs/gib3.mdl", self.health);
  386.       return;
  387.    }
  388.  
  389. // regular death
  390.    sound (self, CHAN_VOICE, "scourge/pain2.wav", 1, ATTN_NORM);
  391.    scourge_die1 ();
  392. };
  393.  
  394. //
  395. // scourge_melee
  396. //
  397. void() scourge_melee =
  398.    {
  399.     local float chance;
  400.  
  401. //   chance = random();
  402. //   if (chance < 0.5 )
  403. //      {
  404.       scourge_melee1();
  405. //      }
  406. //   else
  407. //      return;
  408.    SUB_AttackFinished (2*random());
  409.    };
  410.  
  411. //
  412. // ScourgeTriggerThink
  413. //
  414. void() ScourgeTriggerThink =
  415.    {
  416.    local entity targ;
  417.  
  418.    if (self.lastvictim.health<=0)
  419.       {
  420.       remove(self);
  421.       return;
  422.       }
  423.    targ = self.lastvictim;
  424.    makevectors(targ.angles);
  425.    setorigin(self, targ.origin + (v_forward*300) );
  426.    self.nextthink = time + 0.1;
  427.    };
  428.  
  429. //
  430. // ScourgeTriggerTouch
  431. //
  432. void() ScourgeTriggerTouch =
  433.    {
  434.    local entity targ;
  435.    local entity tempent;
  436.    local vector dir;
  437.  
  438.    if (other.flags & (FL_MONSTER|FL_CLIENT))
  439.       return;
  440.    if (other.movetype != MOVETYPE_FLYMISSILE)
  441.       return;
  442.    targ = self.lastvictim;
  443.    if (targ.health<=0)
  444.       {
  445.       remove(self);
  446.       return;
  447.       }
  448.    dir = targ.origin - other.origin;
  449.    dir = normalize(dir);
  450.    if ((dir * normalize(other.velocity))<0.8)
  451.       return;
  452.  
  453. //   targ.think = targ.th_run;
  454. //   if (targ.flags & FL_ONGROUND)
  455. //      {
  456.       if (time > self.duration)
  457.          {
  458.          tempent = self;
  459.          self = targ;
  460.          if (random()<0.5)
  461.             scourge_strafeleft1();
  462.          else
  463.             scourge_straferight1();
  464.          self.duration = time + 1.5;
  465.          }
  466. /*
  467.       targ.origin_z = targ.origin_z + 1;
  468.       targ.velocity = targ.velocity + '0 0 500';
  469.       targ.flags = targ.flags - FL_ONGROUND;
  470. */
  471.       self = tempent;
  472. //      }
  473. //   dprint("ouch\n");
  474.    };
  475.  
  476. /*QUAKED monster_scourge (1 0 0) (-16 -16 -24) (16 16 40) Ambush
  477.  
  478. */
  479. void() monster_scourge =
  480. {
  481.    local entity trig;
  482.  
  483.     if (deathmatch)
  484.     {
  485.         remove(self);
  486.         return;
  487.     }
  488.    precache_model2 ("progs/scor.mdl");
  489.    precache_model2 ("progs/h_scourg.mdl");
  490.     precache_model2 ("progs/laser.mdl");
  491.    precache_model2 ("progs/s_light.mdl");
  492.    precache_model2 ("progs/spike.mdl");
  493.  
  494.    precache_sound ("misc/null.wav");
  495.    precache_sound ("scourge/idle.wav");
  496.    precache_sound ("scourge/pain.wav");
  497.    precache_sound ("scourge/pain2.wav");
  498.    precache_sound ("scourge/sight.wav");
  499.    precache_sound ("scourge/tailswng.wav");
  500.    precache_sound ("scourge/walk.wav");
  501.    precache_sound2 ("shambler/smack.wav");
  502.    precache_sound2 ("weapons/rocket1i.wav");
  503.  
  504.     self.solid = SOLID_SLIDEBOX;
  505.     self.movetype = MOVETYPE_STEP;
  506.  
  507.    setmodel (self, "progs/scor.mdl");
  508.  
  509.    setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
  510.    self.health = 300;
  511.  
  512.    self.th_stand = scourge_stand1;
  513.    self.th_walk = scourge_walk1;
  514.    self.th_run = scourge_run1;
  515.    self.th_pain = scourge_pain;
  516.    self.th_die = scourge_die;
  517.    self.th_melee = scourge_melee;
  518.    self.th_missile = scourge_atk1;
  519. //   self.th_turn = scourge_turn1;
  520.    self.yaw_speed = 60;
  521.    self.attack_state = AS_DODGING;
  522.    self.state = 0;
  523.  
  524.     walkmonster_start();
  525. };
  526.